#!/bin/sh
#
# stop -- stop a docker lab
#
# Copyright (C) 2016-2021 Wu Zhangjin <falcon@ruma.tech>
#

TOP_DIR="$(cd "$(dirname "$0")"/../../ && pwd)"
. "$TOP_DIR"/tools/docker/config >/dev/null

[ -z "$CONTAINER_NAME" ] && info_print "No lab container recorded." && exit 0

notify_user 2 "Lab will be stopped"

info_print "Stop $CONTAINER_NAME"
do_op "docker stop" CONTAINER_NAME

if [ "$RELEASE" != '0' ]; then
  log_print "Update release page"
  "$DOCKER_RELEASE_CMD" all >/dev/null 2>&1
fi
